#pragma once
#include <SFML/Graphics/Texture.hpp>
#include <nice2d/component.h>
#include <nice2d/sprite.h>
#include <nice2d/text.h>

class Scene : public Entity
{
    DECLARE_OBJECT(Scene)
public:
    Scene(const std::string &name = std::string());
    virtual ~Scene();
public:
    std::string getSceneName()const;

    void setSceneBox(const sf::FloatRect &box);
    sf::FloatRect getSceneBox()const;

    void setBackground(BackgroundPointer background);

    std::shared_ptr<Text> createToastText();
public:
    void initial();
    void exit();
protected:
    virtual void onInitialed();
    virtual void onExit();

    void onUpdateNode(float deltaTime)override;
    virtual void onUpdateScene(float deltaTime);

    void onDrawEntity(sf::RenderTarget &target, sf::RenderStates states) const override;
    virtual void onDrawScene(sf::RenderTarget &target, sf::RenderStates states);
private:
    std::unique_ptr<class SceneData> data;
};
